using LFramework;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class ChatData
{
    /// <summary>
    /// 是否是机器人
    /// </summary>
    public bool isBot;
    /// <summary>
    /// 文本内容
    /// </summary>
    public string content;
}

public class ChatItem : MonoBehaviour
{
    public void BindData(ChatData data)
    {
        GameObject head;
        TextMeshProUGUI content;
        if (data.isBot)
        {
            head = transform.Find("Robet").gameObject;
            content = transform.Find("RContent").GetComponent<TextMeshProUGUI>();
        }
        else
        {
            head = transform.Find("User").gameObject;
            content = transform.Find("UContent").GetComponent<TextMeshProUGUI>();
        }

        head.SetActive(true);
        content.SetActive(true);

        content.text = data.content;
    }
}
